package com.cloudwise.thread;

import com.cloudwise.util.TreeUtil;
import org.springframework.util.StopWatch;
import sun.reflect.generics.tree.Tree;

/**
 * @author ：Teacher陈
 * @date ：Created in 2021/1/5 10:56
 * @description：继承方式实现多线程
 * @modified By：
 * @version: 1
 */
public class ExtendsThread  extends  Thread {
    private String ip;

    public ExtendsThread( String ip) {
        this.ip = ip;
    }

    @Override
    public void run() {
        TreeUtil.checkHost(ip);
    }

    public static void main(String[] args) {
      /*  StopWatch sw= new StopWatch();
        sw.start();*/
        for (int i = 1; i <255 ; i++) {
            String ip="192.168.0."+i;
            //创建一个多线程对象
            ExtendsThread extendsThread= new ExtendsThread(ip);
            //启动多线程
            extendsThread.start();

        }
        /*sw.stop();

        System.out.println("总花费时间："+sw.getTotalTimeMillis());*/
    }
}
